/**
 * Implementation of a singleton logger class
 */
#include <string>
#include "Logger.h"
using namespace std;

Logger Logger::sInstance;

Logger::Logger() : kLogLevelDebug("DEBUG"),	kLogLevelInfo("INFO"),kLogLevelError("ERROR"),
	mLogFileName("log.out")
{
	mOutputStream.open(mLogFileName, ios_base::app);
	if(!mOutputStream.good() ) {
		cerr << "Unable to initialize the Logger!" << endl;
	}
}

Logger::~Logger()
{
	mOutputStream.close();
}

Logger& Logger::instance()
{
	return sInstance;
}

void Logger::log(const string& inMessage, const string& inLogLevel)
{
	mOutputStream << "[" << inLogLevel << "]" << inMessage << endl;
}

void Logger::log(const vector<string>& inMessages, const string& inLoglevel)
{
	for (size_t i=0; i<inMessages.size(); i++) {
		log(inMessages[i], inLoglevel);
	}
}

